import React from 'react'
import { useAppContext } from '../context/Appcontext';

const Header = (props) => {
    const {state} = useAppContext();
    const gotoHome = ()=>{
        props.history.replace('/')
    }
    const gotoCollect = ()=>{
		props.history.replace('/collect')
	}
    return (
        <div className='header'>
            <span onClick={gotoHome}>首页</span>
            <span>&nbsp; &nbsp; &nbsp;</span>
            <span onClick={gotoCollect}> 收藏 </span>
            <span className='username'>{state.username}</span>
        </div>
    )
}
export default Header;